<?php
	session_start();
	
include ('database_connect.php');
include ('mysqlfunctions.php');

$username = $_POST['myusername'];
$password = $_POST['mypassword'];



addMember($username, $password); 

$sql="SELECT * FROM member WHERE username='$username'";
$result=mysql_query($sql);
$row = mysql_fetch_assoc($result);
$validation = $row['validation'];


// The message
$message = "Hi.  \n In order to complete registration you will need to go here: 
http://uhbookselling.net78.net/authentication.php \n
Authentication code: ";

// Wordwrapping
$message = wordwrap($message, 60);

$message = $message.$validation;
// Send
mail($username, 'Thank you for registering.  Your account is almost set up.', $message);



	?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Mailer</title>

<style type="text/css">
body {
	font-family:"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif;
	font-size:12px;
}

fieldset {
	background:#EBF4FB none repeat scroll 0 0;
	border:2px solid #B7DDF2;
	width: 500px;
}
legend {
	color: #fff;
	background: #80D3E2;
	border: 1px solid #781351;
	padding: 2px 6px
}

p {
	border-bottom:1px solid #B7DDF2;
	color:#666666;
	font-size:11px;
	margin-bottom:20px;
	padding-bottom:10px;
}

a{
    color:#0099FF;
font-weight:bold;
}

/* Box Style */


 .success, .warning, .errormsgbox, .validation {
	border: 1px solid;
	margin: 0 auto;
	padding:10px 5px 10px 50px;
	background-repeat: no-repeat;
	background-position: 10px center;
     font-weight:bold;
     width:450px;
     
}

.errormsgbox {
 
	color: #D8000C;
	background-color: #FFBABA;
	background-image: url('img/error.png');
	
}

</style>

</head>
<body>
<?php
session_start();
session_destroy();
echo "<center><fieldset>
					<legend>Notice</legend>
						<div class=\"errormsgbox\">
						<strong>Thank you for registering! </strong><br>
You will now need to authenticate your email address.
You should be receiving a verification email soon.  
						</div>
				</fieldset></center>";
			header("refresh:5;url=index.php");
?>
</html>

	

